import request from "@/utils/request";

export function fetchList(query) {
    return request({
        url: "/device/api/deviceProduct/query/page",
        method: "get",
        params: query
    });
}
//查询所有关联指定设备详情列表，
export function fetchDetailList(query) {

    const { id, current } = query
    return request({
        url: `/device/api/deviceProduct/query/asset/page/${id}`,
        method: "get",
        params: current
    });
}
//查询历史档案信息
export function fetchHistoryList(id) {
    return request({
        url: `/device/api/productArchive/query/list/${id}`,
        method: "get"
            //params: query
    });
}
//查询入库
export function fetchInStockList(query) {
    const { productId, current } = query
    return request({
        url: `/stock/api/stockRecord/query/page/in/${productId}`,
        method: "get",
        params: current
    });
}
//查询出库
export function fetchOutStockList(query) {
    const { productId, current } = query
    return request({
        url: `/stock/api/stockRecord/query/page/out/${productId}`,
        method: "get",
        params: current
    });
}
//保存设备信息
export function saveDeviceInfo(query) {
    if (query.id) {
        return request({
            url: "/device/api/deviceProduct",
            method: "put",
            data: query
        });
    } else {
        return request({
            url: "/device/api/deviceProduct",
            method: "post",
            data: query
        });
    }
}
//设备详细信息
export function fetchDetailInfo(query) {
    return request({
        url: "/device/api/deviceProduct/query/" + query,
        method: "get"
    });
}
//批量导入
export function importFile(params) {
    return request({
        url: "/device/api/deviceProduct/import",
        method: "get"
    });
}
//下载批量导入模板

export function downloadTemplete(query) {
    return request({
        url: "/device/api/deviceProduct/download/template",
        method: "get",
        params: query
    });
}
//删除台账
export function deleteDeviceInfo(query) {
    return request({
        url: "/device/api/deviceProduct/" + query,
        method: "delete"
            //data: query
    });
}
//出库
export function saveOutStock(query) {
    return request({
        url: "/stock/api/stockInfo/reduceStock",
        method: "put",
        data: query
    });
}

//入库
export function saveInstock(query) {
    return request({
        url: "/stock/api/stockInfo/addStock",
        method: "put",
        data: query
    });
}